﻿using System;
using System.Windows.Data;
using System.Collections.Generic;

using Microsoft.Phone.Controls.Maps.Platform;

namespace Utils.WP7.Bing
{
    public class LocationConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            if (value is Location)
            {
                return (value as Location).ToCoordinate();
            }
            else if (value is IEnumerable<Location>)
            {
                return (value as IEnumerable<Location>).ToCoordinates();
            }
            else
            {
                return null;
            }
        }

        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }
}
